//  Copyright (C) 2014 Xiande (Triston) Cao

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

//=============================================================================
//   File name:  cvsie_datatype.hpp
// Description: This file is used to define some constant (such as PI), self-
//              defined datatype. 
//      Author: X. Cao
//      E-mail: xiande.cao@gmail.com
//=============================================================================

#ifndef CVSIE_DATATYPE_HPP
#define CVSIE_DATATYPE_HPP
#include <complex>
// define MKL_Complex* before include 'mkl_types.h'
// MKL_Complex16 and MKL_Complex8 are defined in mkl_type.h file.
#ifdef MKL //Using MKL library
#define MKL_Complex8 std::complex<float>  
#define MKL_Complex16 std::complex<double>
#include "mkl_types.h"
#include "mkl_lapack.h"
#endif


#define cfloat double 
#define ccomplex complex<double>

// constants
namespace cvsie {
    //constants
    const double EPS0 = 8.854187817e-12;     // Permittivity in free space
    const double MU0 = 1.256637061e-6;       // Permeability in free space
    const double C0 = 299792458; // The speed of light in free space (m/s)

    const double PI = 3.14159265358979;       // PI
    const double TWO_PI = 6.28318530717958;   // 2*PI
    const double FOUR_PI = 12.56637061435916; // 4*PI
    const double HALF_PI = 1.570796326794895; // PI/2
    const double QUAT_PI = 0.7853981633974475; // PI/4

    const int LINEMAX = 512;    //File reading constant
}

// enums
namespace cvsie {

    // return status
    enum ReturnStatus {
        STATUS_SUCCESS = 0,
        STATUS_FAIL_GENERAL = -1,
        STATUS_FAIL_READ_FILE = -2,
        STATUS_FAIL_WRITE_FILE = -3,
        STATUS_FAIL_READ_MEM = -4,
        STATUS_FAIL_WRITE_MEM = -5
    };

    // Mesh file type
    enum MeshFileType {
        MESH27 = 0, ABAQUS, LSDYNA, COE114
    };

    enum MeshType {
        // mesh element type
        TRIA = 0, // TRIA: Triangle
        QUAD = 1, // QUAD: Quadrangle
        TETR = 2, // TETR: Tetrahedron
        PYRA = 3, // PYRA: Pyramid
        PRIS = 4, // PRIS: Prism
        HEXA =5   // HEXA: Hexahedron
    };
}

#endif // CVSIE_DATATYPE_HPP

